#ifndef MATERIAL_H
#define MATERIAL_H

#include "Shader.h"

struct Texture
{
	unsigned int id;
	std::string type;
	std::string path;
};

class Material
{
public:
	const Shader &shader;

	glm::vec3 diffuse;
	glm::vec3 specular;
	glm::vec3 ambient;
	float shininess;

	std::vector<Texture> textures;

	explicit Material(const Shader &shader)
		: shader(shader)
	{
		constexpr auto zero = glm::vec3(0.0f);
		diffuse = zero;
		specular = zero;
		ambient = zero;
		shininess = 64.0f;
	}

	explicit Material(const Shader &shader,
	                  const glm::vec3 &diffuse, const glm::vec3 &specular, const glm::vec3 &ambient,
	                  const float shininess)
		: shader(shader),
		  diffuse(diffuse),
		  specular(specular),
		  ambient(ambient),
		  shininess(shininess) {}

	~Material() = default;

	void setBool(const std::string &name, const bool value) const
	{
		shader.setBool(name, value);
	}

	void setInt(const std::string &name, const int value) const
	{
		shader.setInt(name, value);
	}

	void setFloat(const std::string &name, const float value) const
	{
		shader.setFloat(name, value);
	}

	void setVec2(const std::string &name, const glm::vec2 &value) const
	{
		shader.setVec2(name, value);
	}

	void setVec3(const std::string &name, const glm::vec3 &value) const
	{
		shader.setVec3(name, value);
	}

	void setVec4(const std::string &name, const glm::vec4 &value) const
	{
		shader.setVec4(name, value);
	}

	void setMat2(const std::string &name, const glm::mat2 &mat) const
	{
		shader.setMat2(name, mat);
	}

	void setMat3(const std::string &name, const glm::mat3 &mat) const
	{
		shader.setMat3(name, mat);
	}

	void setMat4(const std::string &name, const glm::mat4 &mat) const
	{
		shader.setMat4(name, mat);
	}
};

#endif //MATERIAL_H
